/* Copyright (c) 2009-2010, Sean A.O. Harney <sharney3@gmail.com> */

#ifndef FUZZER_DL_H
#define FUZZER_DL_H


#define MAX_DL_FUNC_ARGS 1024	//should be enough

typedef enum {
    TYPE_CSTRING_PTR, TYPE_GENERIC_PTR, TYPE_INT, TYPE_FLOAT
} DL_ARG_TYPE;

typedef struct st_dlarg *DL_ARG_P;

/* used inside llists generally. */
struct st_dlarg {
    DL_ARG_TYPE type;
    size_t ptr_len;		//set if type is TYPE_GENERIC_PTR
    union {
	void *ptr_val;		// TYPE_GENERIC_PTR
	char *string_val;
	int int_val;		//TYPE_INT
	float float_val;	//TYPE_FLOAT
    } val;
};


/* prototypes */
bool dl_launch(LLIST_P argslist, const char *libfname, const char *symbol);
char *dlarg_type_to_str(DL_ARG_TYPE type);
DL_ARG_P new_dlarg_cstring_ptr(char *val);
DL_ARG_P new_dlarg_generic_ptr(void *val, size_t ptr_len);
DL_ARG_P new_dlarg_int(int val);
DL_ARG_P new_dlarg_float(float val);

#endif				/* FUZZER_DL_H */
